<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simGetContactInfo</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simGetContactInfo" id="simGetContactInfo"></a>simGetContactInfo / sim.getContactInfo </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Retrieves contact point information of a dynamic simulation pass. <br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simGetContactInfo(simInt dynamicPass,simInt objectHandle,simInt index,simInt* objectHandles,simFloat* contactInfo)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>dynamicPass</strong>: a specific dynamic sub-step index or sim_handle_all. By default a call to <a href="simHandleDynamics.htm">simHandleDynamics</a> executes the dynamics engine x times, with x times smaller time steps (where x is a parameter that can be adjusted). At each of those sub-steps, contacts are created and destroyed. With the dynamicPass argument you can select which sub-step you wish to retrieve contacts from (zero-based index), or sim_handle_all to retrieve the contacts of all sub-steps. See also <a href="simGetInt32Parameter.htm">simGetInt32Parameter</a>(sim_intparam_dynamic_step_divider).<br>
</div>
<div><strong>objectHandle</strong>: handle of a specific object you wish to retrieve contacts from, or sim_handle_all to retrieve all contacts in the scene.<br>
</div>
<div><strong>index</strong>: zero-based index of the contact to retrieve. Optionally, you may add sim_handleflag_extended to the index, if you also wish to retrieve the normal vector (see further down)<br>
</div>
<div><strong>objectHandles</strong>: handles of the two objects contacting. The handles might also refer to particle objects that are not treated as regular scene objects.<br>
</div>
<div><strong>contactInfo</strong>: pointer to 6 values (or 9 values if sim_handleflag_extended was added to index), where the 3 first values represent the contact position, the 3 next values represent the force generated by the contact, and the (optional) 3 last values represent the normal vector at the contact.<br>
</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>-1 in case of an error, 0 if no contact was found at the given index or 1 if a contact was returned.<br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>table_2 collidingObjects,table_3 collisionPoint,table_3 reactionForce,table_3 normalVector=sim.getContactInfo(number dynamicPass,number objectHandle,number index)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div>Similar to the C-function counterpart</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div><strong>collidingObjects</strong>: handles of the two objects contacting. The handles might also refer to particle objects that are not treated as regular scene objects</div>
<div><strong>collisionPoint</strong>: coordinates of the contact</div>
<div><strong>reactionForce</strong>: vector that represents the force generated by the contact</div>
<div><strong>normalVector</strong>: the normal vector at the contact point</div>
</td> 
</tr> 
</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
